package cn.edu.hbsi.dao;

import cn.edu.hbsi.domain.Product;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ProductDao
{
    //根据产品id查询产品
    @Results({
            @Result(id = true,property = "pId",column = "id"),
            @Result(property = "pName",column = "name"),
            @Result(property = "pPrice",column = "price")
    })
    @Select("select * from tb_Product where id in (select product_id from tb_ordersitem where orders_id=#{pId})")
    public List<Product> selectProductByPId(@Param("pId") Integer pId);
}
